home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PROGEDIT / 3458A.ZIP / AMAC44A.ZIP / MIS004.QM < prev    next >
Text File  |  1991-11-24  |  11KB  |  228 lines

  1. *                               mis004.qm
  2. *                 Miscellaneous Macros to Compare Files
  3. *                        Written By Tom Hogshead
  4. *                       [ See MISCxx.QM For Use ]
  5. *                                11/24/91
  6. *  Key    Subfile              Description
  7. * =====  =========        ==============================================
  8. * @(1) Compare Two Files: Compares contents of two files and shows in    |new
  9. *                         the Nul file, as they are found, all
  10. *                         different lines in file #1 whose first 59
  11. *                         characters are NOT contained anywhere in file #2.
  12. * @(2) Compare Each Line of Two Files on a Line by Line Basis:           |new
  13. *                         Compares contents of two files on a line by
  14. *                         line basis displaying only lines in file #1
  15. *                         different than the same line number in file #2.
  16. * @(3) Compare Each Line of Two Files on a Line by Line Basis            |new
  17. *      Pausing at Each Different Line:
  18. *                         Compares contents of two files on a line by
  19. *                         line basis pausing at each line in file #1
  20. *                         different than the same line number in file #2.
  21. * @(4) Compare Two Files Pausing at Each Different Line,                 |new
  22. *      Does Not Get "Unsynchronized":
  23. *                         Compares contents of two files pausing at
  24. *                         each line in file #1 that does not exist in
  25. *                         file #2.  Does not get "unsynchronized" or
  26. *                         confused.
  27. *
  28. *         {e:\up\MISC*}--Return To MISCxx.QM
  29. *
  30. *-- eoi
  31.  
  32. *      Macros @1 to @4m written at the request of Jim Bates on
  33. *      Smartnet, compare contents of two files:
  34. *
  35. *               Files #1, #2 and Nul are quit by pressing <enter> at
  36. *         macro completion.  Remove "setscreenOFF|ON" if you are not
  37. *         using QEdit v2.15.  Swap last two lines if you have Qconfig
  38. *         set to NOT close windows on quit.  "Find" dialog box is
  39. *         limited to 59 characters, thus any file difference in columns
  40. *         60+ will not be detected.
  41. *             Speed of these macros depends on file sizes being
  42. *         compared, the number of different lines, Qconfig setup and
  43. *         hardware.  If beeps are set ON, file differences will be
  44. *         heard but this can slow down macro speed more than 200%.
  45. *         Macro @1 will run approximately 40% faster, by removing the
  46. *         second setscreenoff line -- detecting approximately 40
  47. *         different lines per second on a 12 mhz AT.
  48.  
  49. *                          M A C R O S
  50. * ----------------------------------------------------------------------
  51. * @(1) Compare Two Files
  52. * ----------------------------------------------------------------------
  53. * This macro compares the contents of two files and shows in the Nul
  54. * file, as they are found, all different lines in file #1 (entered at
  55. * first pause) whose first 59 characters are NOT contained anywhere in
  56. * file #2 (entered at second pause).  
  57.  
  58. @1 macrobegin
  59.         setscreenoff
  60.         onewindow endline unmarkblock dropanchor
  61.         editfile "nul" return quit gotoblockbeg unmarkblock
  62.         setscreenon
  63.         editfile delline pause return begfile insertline horizontalwindow
  64.         editfile delline pause return begfile insertline horizontalwindow
  65.         editfile "nul" return begfile zoomwindow
  66.         setscreenoff
  67.         nextwindow
  68.      A: endline begline jtrue B  cursordown jfalse END  jump A
  69.      B: dropanchor endline copy
  70.         nextwindow find paste return "G" return jfalse D
  71.         prevwindow
  72.      C: cursordown jfalse END  jump A
  73.      D: nextwindow paste unmarkblock zoomwindow endfile
  74.         setscreenon setscreenoff    * Remove line to increase macro speed
  75.         nextwindow jump C
  76.    END: prevwindow zoomwindow unmarkblock begfile setscreenon
  77.         pause
  78.         quit quit quit onewindow
  79. * *---- Use this line if Qconfig set to NOT close windows on quit ----*
  80. *       quit closewindow quit closewindow quit closewindow onewindow
  81. *
  82. * 105 bytes Sun  11-03-1991  22:29:52 (TH @1, ver 1)
  83. * 101 bytes Tue  11-05-1991  11:05:19 (TH @1, shortened, for all Qconfig's)
  84.  
  85. * 
  86. * ----------------------------------------------------------------------
  87. * @(2) Compare Each Line of Two Files on a Line by Line Basis
  88. * ----------------------------------------------------------------------
  89. * This macro compares the contents of two files on a line by line
  90. * basis.  All lines in file #1 (entered at first pause) whose first 59
  91. * characters do not exist in the same line number in file #2 (entered
  92. * at second pause) are shown in the Nul file as found.
  93.  
  94. * @2 differs from @1 in that @1 only shows lines whose first 59
  95. * characters do not exist ANYWHERE in file #2.  Macro @2 shows all
  96. * lines in file #1 whose first 59 characters do not exist in the same
  97. * line number in file #2.  Capitalized lines show differences from @1.
  98.  
  99. @2 macrobegin
  100.         setscreenoff
  101.         onewindow endline unmarkblock dropanchor
  102.         editfile "nul" return quit gotoblockbeg unmarkblock
  103.         setscreenon
  104.         editfile delline pause return begfile insertline horizontalwindow
  105.         editfile delline pause return begfile insertline horizontalwindow
  106.         editfile "nul" return begfile zoomwindow
  107.         setscreenoff
  108.         nextwindow
  109.      A: endline begline jtrue B  cursordown jfalse END
  110.         NEXTWINDOW CURSORDOWN PREVWINDOW jump A
  111.      B: dropanchor endline copy
  112.         nextwindow
  113.         MARKLINE ENDLINE CURSORRIGHT
  114.         FIND PASTE RETURN "BL" RETURN JFALSE D
  115.         CURSORDOWN
  116.         prevwindow
  117.      C: cursordown jfalse END  jump A
  118.      D: CURSORDOWN nextwindow paste unmarkblock zoomwindow endfile
  119.         setscreenon setscreenoff    * Remove line to increase macro speed
  120.         nextwindow jump C
  121.    END: prevwindow zoomwindow unmarkblock begfile setscreenon
  122.         pause
  123.         quit quit quit onewindow
  124. * *---- Use this line if Qconfig set to NOT close windows on quit ----*
  125. *       quit closewindow quit closewindow quit closewindow onewindow
  126. *
  127. * 111 bytes Mon  11-04-1991  21:06:40 (TH @2)
  128.  
  129. * 
  130. * ----------------------------------------------------------------------
  131. * @(3) Compare Each Line of Two Files on a Line by Line Basis Pausing
  132. *      at Each Different Line
  133. * ----------------------------------------------------------------------
  134. * This macro compares the contents of two files on a line by line basis
  135. * and pauses at each line in file #1 that is different than the same
  136. * line number in file #2.  Press <enter> to move to and pause the next
  137. * different line.  After all different lines have been found, then a
  138. * list of all the different lines in file #1 (entered at first pause)
  139. * whose first 59 characters do not exist in the same line number in
  140. * file #2 (entered at second pause) are shown in the Nul file.  Press
  141. * <enter> to quit file #1, #2 and Nul, and finally end the macro by
  142. * return to starting file.
  143.  
  144. * @3 differs from @2 in that it pauses at each different line in file
  145. * #1 and can get unsynchronized at the point corrresponding line
  146. * numbers do not match.  Macro @2 only shows a list of all
  147. * different lines in file #1 as they are found and whose first 59
  148. * characters do not exist in the same line number in file #2.
  149.  
  150. @3 macrobegin
  151.         setscreenoff
  152.         onewindow endline unmarkblock dropanchor
  153.         editfile "nul" return quit gotoblockbeg unmarkblock
  154.         setscreenon
  155.         editfile delline pause return begfile insertline horizontalwindow
  156.         editfile delline pause return begfile insertline horizontalwindow
  157.         editfile "nul" return begfile zoomwindow
  158.         setscreenoff
  159.         nextwindow
  160.      A: endline begline jtrue B  cursordown jfalse END
  161.         NEXTWINDOW CURSORDOWN PREVWINDOW jump A
  162.      B: dropanchor endline copy
  163.         nextwindow
  164.         MARKLINE ENDLINE CURSORRIGHT
  165.         FIND PASTE RETURN "BL" RETURN JFALSE D
  166.         CURSORDOWN
  167.         prevwindow
  168.      C: cursordown jfalse END  jump A
  169.      D: CURSORDOWN PREVWINDOW ZOOMWINDOW SETSCREENON
  170.         PAUSE
  171.         SETSCREENOFF SETSCREENON SETSCREENOFF  * Removes "P", turns off screen
  172.         PREVWINDOW PASTE ENDFILE
  173.         nextwindow jump C
  174.    END: prevwindow zoomwindow unmarkblock begfile setscreenon
  175.         pause
  176.         quit quit quit onewindow
  177. * *---- Use this line if Qconfig set to NOT close windows on quit ----*
  178. *       quit closewindow quit closewindow quit closewindow onewindow
  179. *
  180. * 114 bytes Mon  11-04-1991  20:46:57 (TH @3)
  181.  
  182. * 
  183. * ----------------------------------------------------------------------
  184. * @(4) Compare Two Files Pausing at Each Different Line,
  185. *      Does Not Get "Unsynchronized"
  186. * ----------------------------------------------------------------------
  187. * This macro compares the contents of two files and pauses at each line
  188. * in file #1 that does not exist anywhere in file #2.  Press <enter> to
  189. * move to and pause the next different line in file #1.  After all
  190. * different lines have been found, then a list of all the different
  191. * lines in file #1 (entered at first pause) whose first 59 characters
  192. * do not exist in the same line number in file #2 (entered at second
  193. * pause) are shown in the Nul file.  Press <enter> to quit file #1, #2
  194. * and Nul, and finally end the macro by return to starting file.
  195.  
  196. * @4 differs from @3 in that it does not get "unsynchronized" or
  197. * confused if text is not found on the same line in file #2.  It does a
  198. * Global "G" search, and if text is found anywhere in file #2 it
  199. * considers that found text as the corresponding line in file #1.
  200.  
  201. @4 macrobegin
  202.         setscreenoff
  203.         onewindow endline unmarkblock dropanchor
  204.         editfile "nul" return quit gotoblockbeg unmarkblock
  205.         setscreenon
  206.         editfile delline pause return begfile insertline horizontalwindow
  207.         editfile delline pause return begfile insertline horizontalwindow
  208.         editfile "nul" return begfile zoomwindow
  209.         setscreenoff
  210.         nextwindow
  211.      A: endline begline jtrue B  cursordown jfalse END  jump A
  212.      B: dropanchor endline copy
  213.         nextwindow Find paste return "G" return jfalse D
  214.         prevwindow
  215.      C: cursordown jfalse END  jump A
  216.      D: PREVWINDOW ZOOMWINDOW SETSCREENON
  217.         PAUSE
  218.         SETSCREENOFF SETSCREENON SETSCREENOFF  * Removes "P", turns off screen
  219.         PREVWINDOW PASTE ENDFILE
  220.         nextwindow jump C
  221.    END: prevwindow zoomwindow unmarkblock begfile setscreenon
  222.         pause
  223.         quit quit quit onewindow
  224. * *---- Use this line if Qconfig set to NOT close windows on quit ----*
  225. *       quit closewindow quit closewindow quit closewindow onewindow
  226. *
  227. * 104 bytes Tue  11-05-1991  11:15:49 (TH @4)
  228.